package com.astro.business;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.astro.domain.bean.TblUser;

@Service("userManager")
@Transactional(value = "transactionManager", propagation = Propagation.REQUIRED)
public class UserManager extends BaseManager {
	
	public TblUser getUserByEmail(String email) throws Exception {
		List<TblUser> userList = getUserDAO().findByProperty("email", email);
		return (userList != null && userList.size()>0)? userList.get(0): null;

	}

	/**
	 * This method insert data into CUSTOMER table
	 */
	public void addUser(TblUser user) throws Exception {
		if (user != null) {
			// Call DAO layer to insert user into database
			getUserDAO().addTblUser(user);
		}		
	}
}